//
//  BTManager.h
//  BTDemo
//
//  Created by Avery on 14-8-22.
//  Copyright (c) 2014年 Alvin. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <ExternalAccessory/ExternalAccessory.h>

static NSTimeInterval const SEND_CMD_DURATION       = 0.1f;

typedef NS_ENUM(NSInteger, BTStatus)
{
    BTStatusDisconnect   = 0,
    BTStatusPowerOff     = 1,
    BTStatusConnected    = 2
};
//Define BLOCK type
typedef void(^BTManagerCompletion_Array)(NSArray *);
typedef void(^BTManagerCompletion_Error)(NSError *);
typedef void(^BTManagerCompletion_Status)(BTStatus);
typedef void(^BTManagerCompletion_Object)(id);
typedef void(^BTManagerCompletion_Error_Array) (NSError *, NSArray *);

@class Device;
@class BTSendData;
@interface BTManager : NSObject

@property (nonatomic,copy) BTManagerCompletion_Array  completion_array;
@property (nonatomic,copy) BTManagerCompletion_Error  completion_error;
@property (nonatomic,copy) BTManagerCompletion_Status  completion_status;
@property (nonatomic,copy) BTManagerCompletion_Object completion_Log;

+(BTManager *)shareInstance;

//Config Manager
//- (void)setupManager:(BTConfigure *)configure;

//Connect to device
- (void)connectToDevice;

//Disconnect to device
- (void)disconnectToDevice;

//Check device is connected
- (BOOL)isDeviceConnected;

//Get current connected device
- (Device *)currentDevice;

/**
 *  Send data to Device
 *
 *  @param data Command data need to be sent
 */
- (void)sendData:(BTSendData *)data;


/**
 *  Show system scan device view
 */
- (void)scanDevice;

@end
